package com.yk.pool;


import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * Created with IntelliJ IDEA.
 * User: caojia
 * Date: 2016/1/20
 * Time: 11:06
 * To change this template use File | Settings | File Templates.
 */
public final class RejectedExecutionHandlerImpl implements RejectedExecutionHandler {

    @Override
    public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
        try {
            System.out.println("拒绝");
            CommonInterface commonInterface = ((WorkThread) r).getCommonInterface();
            commonInterface.handlerExecute(r,executor);
        } catch (Exception e) {
            System.out.println("线程池拒绝任务，存取失败:" + e.getMessage());
            e.printStackTrace();
        }
    }
}
